package com.hospital.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hospital.model.UserInfo;
import com.hospital.util.DbUtil;

@WebServlet("/manage/UserInfoItemServlet")
public class UserInfoItemServlet extends HttpServlet {

	protected void doPost(HttpServletRequest request,HttpServletResponse response) 
			throws ServletException, IOException {
		String method = request.getParameter("method");
		if ("modify".equals(method)) {
			int id = ((UserInfo)(request.getSession().getAttribute("userInfo"))).getId();
			String item = request.getParameter("item").trim();
			String sql = "update t_user_info set item = '" + item + "' where id = " + id;
			DbUtil.add_modify(sql);
		}
		request.setAttribute("rs", "设置成功。");
		request.getRequestDispatcher("/manage/user_item.jsp").forward(request, response);
	}
}
